<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('发布顶岗实习')" />
	<th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-role-add">
			<div class="form-group">
				<label class="col-sm-3 control-label ">名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" value="顶岗实习" name="workName" id="workName" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">申请要求：</label>
				<div class="col-sm-8">
					<textarea class="form-control" type="text" name="workRequire" id="workRequire"  required></textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">申请截至时间：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="workOver" id="workOver" required placeholder="年-月-日">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">周报数量：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="workWeeks" id="workWeeks" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">周报填写要求：</label>
				<div class="col-sm-8">
					<textarea class="form-control" type="text" name="workWeekly" id="workWeekly" required></textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">周报开始时间：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="workBegin" id="workBegin" required placeholder="年-月-日">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">周报结束时间：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="workEnd" id="workEnd" required placeholder="年-月-日">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">周报成绩占比(%)：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="pacific" id="pacific" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">总结成绩占比(%)：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="exam" id="exam" required>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: ztree-js" />
	<th:block th:include="include :: datetimepicker-js" />
	<script type="text/javascript">
		var prefix = ctx + "sau/work";
	    $(function() {
			$("#workOver").datetimepicker({
				format: "yyyy-mm-dd",
				minView: "month",
				autoclose: true
			});
			$("#workBegin").datetimepicker({
				format: "yyyy-mm-dd",
				minView: "month",
				autoclose: true
			});
			$("#workEnd").datetimepicker({
				format: "yyyy-mm-dd",
				minView: "month",
				autoclose: true
			});
		});

		
		function submitHandler() {
	        if ($.validate.form()) {
	        	add();
	        }
	    }
	
		function add() {
			if ($.validate.form()) {
				var workName = $("input[name='workName']").val();
				var workRequire = $("textarea[name='workRequire']").val();
				var workOver = $("input[name='workOver']").val();
				var workWeeks = $("input[name='workWeeks']").val();
				var workWeekly = $("textarea[name='workWeekly']").val();
				var workBegin = $("input[name='workBegin']").val();
				var workEnd = $("input[name='workEnd']").val();
				var pacific = $("input[name='pacific']").val();
				var exam = $("input[name='exam']").val();
				$.ajax({
					cache: true,
					type: "POST",
					url: ctx + "sau/work/addWork",
					data: {
						"workName": workName,
                        "workRequire":workRequire,
						"workOver": workOver,
						"workWeeks": workWeeks,
						"workWeekly": workWeekly,
						"workBegin": workBegin,
						"workEnd": workEnd,
						"pacific": pacific,
						"exam": exam
					},
					async: false,
					error: function (request) {
						$.modal.alertError("系统错误");
					},
					success: function (data) {
						$.operate.successCallback(data);
					}
				});
			}
		}

	</script>
</body>
</html>
